<template>
  <div class="tabscontainer" >
    <div class="tabitem" :class="{'activeStyle':index==current}"  v-for="(value,index) in tablist" :key="value.text"
    @click="handleclick(index,value.name)">
      <span :class="['iconfont',value.icon]"></span>
      <span>{{value.text}}</span>
    </div>
  
  </div>
</template>

<script>
export default {
    data () {
        return {
            current:0
        }
    },
    props:{
        tablist:{
            type:Array,
            require:true,
        }
    },
    methods: {
        handleclick(index,name){
            console.log(index,name);
            this.current=index
            this.$emit('changCom',name)
        }
    }
}
</script>

<style lang="less" scoped>
.tabscontainer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50px;
  display: flex;
  border-top: 1px solid #efefef;
  justify-content: space-around;
  align-items: center;
  background-color: white;
  .tabitem {
    display: flex;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
  }
  // 激活项的样式
  .activeStyle {
    color: red;
  }
}
</style>